Skip to content

Reconcile chr-prefix conventions in the LD-sketch lookup#539

Merged
danielnachun merged 1 commit into
StatFunGen:mainfrom
Yining97:ldsketch-chr-prefix-match
Jun 30, 2026
Merged

Reconcile chr-prefix conventions in the LD-sketch lookup#539
danielnachun merged 1 commit into
StatFunGen:mainfrom
Yining97:ldsketch-chr-prefix-match

Conversation

@Yining97

Copy link
Copy Markdown
Contributor

.ldFromSketch matched requested variant ids against the panel with a raw string match, so genotype-LD fine-mapping (GWAS + QTL) errored with "variant id(s) not present in the LD sketch panel" whenever the entry ids and panel ids referred to the same variants but disagreed only on the chr prefix. pecotmr already ships ensureChrMatch/normalizeVariantId (variantId.R) but wired them in nowhere. This routes the lookup through ensureChrMatch before matching, preserving the caller's labels and the genuinely-absent error.

Tests: prefixed/non-prefixed both directions, same-convention regression, absent-still-errors; test_ld 469/0, test_fineMappingPipeline 385/0, test_sumstatsQc 799/0. Validated on the protocol_example chr22 MWE (common path unchanged; a stripped-prefix panel now resolves).

.ldFromSketch did a raw match of the requested variant ids against the panel's
SNP ids, so genotype-LD fine-mapping failed when the two agreed on the variants
but disagreed on the chr prefix (e.g. chr22:... entry ids vs 22:... panel ids) --
even though variantId.R ships ensureChrMatch for exactly this. Reconcile the two
id sets before matching; keep the caller's ids for the returned labels and fall
back to the raw ids when normalization can't parse them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@danielnachun

Copy link
Copy Markdown
Collaborator

This is a good fix, I will merge it now. I will also do an audit of the rest of the code to make sure this issue doesn't exist elsewhere. chr-prefix mismatches are trivial to solve and should be handled automatically by the package.

@danielnachun danielnachun merged commit 42e97ce into StatFunGen:main Jun 30, 2026
4 of 5 checks passed
@Yining97 Yining97 deleted the ldsketch-chr-prefix-match branch June 30, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants